#pragma once

#include <list>
#include "ClientThread.h"

class Client;
class Chunk;
class Location;
class Block;
class Entity;

class ThreadRender : public ClientThread {
public:
	ThreadRender(Client* cli);
	virtual void run();
	void EnqueueChunkUpdate(Chunk* chunk);
	void SetPickingBlock(Block* block, float x, float y, float z);
	bool mouseClickLeft;
	bool mouseClickRight;
	
	int ssao;
private:
	void RenderEntity(Entity* e);
	void RenderWorld();
	void RenderSun(float* matrix);
	void RenderChunks();
	void RenderPick();
	Client* client;
	int nRchunks;
	int nRchunksFaces;
	Block* picking_block;
	Location* picking_location;
	std::list<Chunk*> chunks_update;
	ge_LensFlare* lensFlare;
	ge_LightScatter* lightScatter;
	ge_Framebuffer* fbo;
	float global_illum;
	u32 cpu_time;
	u32 gpu_time;
	u32 cpu_time_p;
	u32 gpu_time_p;
	u32 general_time;

	ge_Framebuffer* fbo_normal;
	ge_Framebuffer* fbo_final;
	ge_Shader* shader_ssao;
	ge_Shader* shader_normal;
	ge_Shader* shader_final1;
	ge_Shader* shader_final2;
	int loc_kernel;
	int loc_sceneProj;
};
